﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.IO;

namespace KeyboardImageViewer
{
    /// <summary>
    /// Interaction logic for RenameBox.xaml
    /// </summary>
    public partial class RenameBox : Window
    {
        private ImageManager manager;

        public RenameBox(ImageManager manager, MainWindow window)
        {
            this.manager = manager;

            this.Owner = window;

            InitializeComponent();

            this.renameText.Text = Path.GetFileName(this.manager.CurrentImageName);

            this.renameText.SelectionStart = 0;
            this.renameText.SelectionLength = 0;

            this.renameText.Focus();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            this.manager.CurrentImageName = this.renameText.Text;
            this.DialogResult = true;
        }
    }
}
